/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package platform;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import zorg.platform.LongSortedVector;

/**
 *
 * @author Tomasz Nowak
 */
public class TenorLongSortedVector implements LongSortedVector
{
	ArrayList<Long> longs;

	public TenorLongSortedVector()
	{
		longs = new ArrayList<>();
	}

	@Override
	public void removeAllElements()
	{
		longs.clear();
	}

	@Override
	public int size()
	{
		return longs.size();
	}

	@Override
	public int find( Long element )
	{
		return Collections.binarySearch(longs, element);
	}

	@Override
	public void addElement( Long element )
	{
		longs.add(element);
		Collections.sort(longs);
	}

	@Override
	public Long getAt( int index )
	{
		return longs.get(index);
	}

	@Override
	public void removeElementAt( int index )
	{
		longs.remove(index);
	}
}
